const express = require('express');
const indexRouter = require('./routers/index');
const deviceRouter = require('./routers/device');
const path = require('path');
const cors = require('cors');
const app = express();
require('./utils/uuid').createMid()// uuid


app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/device', deviceRouter);


app.use((req, res) => {
    console.log(req.url);
    res.send("404哦，宝贝！！");
})

app.listen(4399, () => {
    console.log('同步服务启动成功!');
})